package com.invengo.testrfid.app.proxy.real;

import com.invengo.testrfid.app.proxy.ProxyNetWorker;
import com.invengo.testrfid.app.proxy.subject.SubjectNetWork;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

public class RealNetWorkerOkgo implements SubjectNetWork {
    @Override
    public void getServerData(String url, final ProxyNetWorker.RequestCallback requestCallback) {

        OkGo.<String>get(url)
                .tag(this)
                .execute(new StringCallback() {

                    @Override
                    public void onSuccess(Response<String> response) {

                        requestCallback.onSuccess(response.body());
                    }

                    @Override
                    public void onError(Response<String> response) {

                        requestCallback.onFailed("请求失败");
                    }
                });
    }
}
